package com.springcontext.factorybean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test {

  @org.junit.Test
  public void test1(){
    AnnotationConfigApplicationContext applicationContext =
            new AnnotationConfigApplicationContext(CompentScanConfig.class);

    Parent bean = applicationContext.getBean(Parent.class);
    bean.doWork();

  }

  @org.junit.Test
  public void test2(){
    AnnotationConfigApplicationContext applicationContext =
            new AnnotationConfigApplicationContext(CompentScanConfig.class);

    Parent bean = applicationContext.getBean(Parent.class);
    bean.doWork();

    Student student = applicationContext.getBean(Student.class);
    student.doWork();

  }


  @org.junit.Test
  public void test3(){
    AnnotationConfigApplicationContext applicationContext =
            new AnnotationConfigApplicationContext(com.springcontext.factorybean.CompentScanConfig.class);

    Parent bean = applicationContext.getBean(Parent.class);
    bean.doWork();

  }

  @org.junit.Test
  public void test4(){
    AnnotationConfigApplicationContext applicationContext =
            new AnnotationConfigApplicationContext(com.springcontext.factorybean.CompentScanConfig.class);

    Parent bean = applicationContext.getBean(Parent.class);
    bean.doWork();

    Student student = applicationContext.getBean(Student.class);
    student.doWork();

  }



}
